//
//  SKUDefultScrUserImageS.m
//  ZITHER
//
//  Created by weixin on 2018/8/16.
//  Copyright © 2018年 weixn. All rights reserved.
//

#import "SKUDefultScrUserImageS.h"

@implementation SKUDefultScrUserImageS

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
    
        [self setUI];
    }
    return self;
}


-(void)setUI{
    
}

-(void)setArrM:(NSMutableArray *)arrM{
    _arrM = arrM;
    
    for (UIView *view in [self subviews]) {
        [view removeFromSuperview];
    }

    //j每组图片的数量
    for (int i =0 ; i<2; i++) {
        
        NSArray *arr = arrM[i];
        
        UIScrollView *scrollview = [[UIScrollView alloc]initWithFrame:CGRectMake(0, i*100, kScreenW,100)];
        scrollview.bounces = NO;
        scrollview.showsHorizontalScrollIndicator = NO;
        scrollview.bounces = NO; // 默认为YES 取消设置NO
        // 当bounces属性为NO时，以下两个属性设置无效
        scrollview.alwaysBounceHorizontal = YES; // 水平方向弹簧效果
        scrollview.alwaysBounceVertical = YES; // 垂直方向弹簧效果
        scrollview.decelerationRate = 0.1; // 值域 0~1 值越小减速停止的时间越短
        scrollview.backgroundColor = [UIColor whiteColor];
        [self addSubview:scrollview];
        scrollview.contentSize = CGSizeMake(68*arr.count+15,0);

        
        
        
        for (int j = 0; j<arr.count; j++) {
            UIImageView * imageV = [[UIImageView alloc]initWithFrame:CGRectMake(j*68+15,35, 60,60)];
            [imageV setCornerRadiusWithRadius:5 isMasks:YES];
            imageV.backgroundColor = [UIColor whiteColor];
            imageV.contentMode = UIViewContentModeScaleAspectFill;
            
            NSString *str = [NSString stringWithFormat:@"%@%@",RootUrlImage,arr[j]];
            
            [imageV sd_setImageWithURL:[NSURL URLWithString:str] placeholderImage:[UIImage imageNamed:@"watchSmale"]];

          
            [scrollview addSubview:imageV];
        }
        
        QMUILabel *lab = [[QMUILabel alloc]initWithFrame:CGRectMake(10,10+100*i, 100, 15)];
        lab.font = [UIFont systemFontOfSize:15];
        if (i==0) {
            lab.text = [NSString stringWithFormat:@"%@次用户询价",self.enquiryCount];
        }else{
            lab.text = [NSString stringWithFormat:@"%@次商家报价",self.offerCount];
        }
        
        [self addSubview:lab];
    }
}
@end
